package com.bulk.generics;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 泛型测试
 *
 * @author 散装java
 * @date 2022-08-29
 */
@SuppressWarnings("all")
public class GenericsTest {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();
        list.add("hello");
        Collection list1 = list;
        list1.add(1);
        for (Object s : list) {
            System.out.println(s.getClass());
        }
        System.out.println(list);

        Collection<Object> list2 = new ArrayList<>();
        list2.add("ss");
        list2.add(2);
        for (Object s : list2) {
            System.out.println(s.getClass());
        }
        System.out.println(list2);
    }
}
